#!/bin/bash

# FTP服务的安装
echo ">>>>Install FTP Service"

MYUSER=yjtftp
MYUSERPASS=yjtftppass
MYUSERPATH=/ftproot/data

# 安装proftpd
rpm -ivh --nomd5 --force --nodeps proftpd/proftpd-*.x86_64.rpm > /dev/null

# copy conf file

# 配置开机启动
echo ">>>>Start FTP Service"
cp -f proftpd/proftpd /etc/init.d
chmod +x /etc/init.d/proftpd
chkconfig --add proftpd
chkconfig proftpd on
service proftpd start

# 配置用户
echo ">>>>Add ftp user: $MYUSER"
useradd -d $MYUSERPATH -s /sbin/nologin $MYUSER
echo $MYUSERPASS | passwd $MYUSER --stdin > /dev/null
chown -R $MYUSER:$MYUSER $MYUSERPATH

